﻿using System.Collections.Generic;
using zTalk.Network;

namespace zTalk
{
    public class SocketUser : SocketWorker
    {
        public static Dictionary<string, SocketUser> Users 
            = new Dictionary<string, SocketUser>();

        private string username = "";

        public string Username
        {
            set
            {
                username = value;
                Users.Add(value, this);
            }
            get
            {
                return username;
            }
        }

        public int UserID { get; set; }

        public override void Close()
        {
            if (Username != "")
            {
                Users.Remove(Username);
                Server.OnUserQuit(this);
            }
            base.Close();
        }
    }
}
